package com.skivingcloud.doc.conf;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * spring doc配置
 * @author hushouquan
 */
@Configuration
@EnableKnife4j
public class SpringDocConfig{
    private static final String TOKEN_HEADER = "Authorization";
    @Bean
    public OpenAPI restfulOpenAPI() {
        return new OpenAPI()
                /*.components(new Components().addSecuritySchemes(TOKEN_HEADER,
                        new SecurityScheme().type(SecurityScheme.Type.APIKEY)
                                .scheme("bearer")
                                .bearerFormat("JWT")))*/
                .info(new Info().title("SkivingCloud Common-boot API")
                        .description("SkivingCloud Common-boot APi")
                        .version("v1.0.1")
                        .license(new License().name("Apache 2.0").url("http://springdoc.org")))
                .externalDocs(new ExternalDocumentation()
                        .description("SpringDoc Wiki Documentation")
                        .url("https://springdoc.org/v2"));
    }
}
